<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function fn() {
           var num = 10;//在函数当中没有使用var关键字声明的变量,叫做全局变量,在script都可以访问
        }
        fn();
        console.log(num);// num is not defined
    </script>
</body>

</html>